package top.mccsdl.Acbot.eventListener.listeners;

import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.mccsdl.Acbot.config.EventName;
import top.mccsdl.Acbot.eventListener.EventListener;

/**
 * 频道加入事件
 */
@Service
@Slf4j
@EventName("GUILD_MEMBER_ADD")
public class GuildMemberAddListener implements EventListener {
    @Override
    public void onEvent(JSONObject eventData) {
//        String groupId = eventData.getString("group_id");
        String nick = eventData.getString("nick");
////        String pdid = eventData.getString("op_user_id");//用户的频道ID
        log.info(DateTime.now() + "成员{}加入频道",nick);
//        Message message = new Message();//主动消息
//        message.setContent(nick+"来啦,欢迎欢迎");
//        String result = HttpRequest.post(String.format(DOMAIN + POST_CHANNELS_PUB_MSG, groupId))
//                .body(message.toJsonStr())
//                 .header("Authorization", "QQBot " + botConfig.getAccessToken)
//                .execute().body();
//        log.info("频道用户加入事件发送返回===>" + result);
    }
}
